﻿using KillBill.Presentation.Common;
using KillBill.Presentation.Modules.Suppliers.Presenter.IView;
using KillBill.Presentation.Modules.Suppliers.SuppliersServiceReference;

namespace KillBill.Presentation.Modules.Suppliers.Presenter
{
    public class ProviderListPresenter
    {
        public IProviderList View { get; set; }

        private readonly SuppliersServiceClient _service;

        public ProviderListPresenter(IProviderList view)
        {
            _service = new SuppliersServiceClient();
            View = view;
            View.Providers = _service.GetProviders(Context.SessionID).Providers;
        }

        public void Find(string value)
        {
            View.Providers = _service.FindProviders(value, Context.SessionID).Providers;
        }
    }
}
